<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:ssui="clr-namespace:OpenLS.Spreadsheet.UI"
  xmlns:ss="http://schemas.Kherty.com/office/2007/spreadsheet" 
  xmlns:oui="http://schemas.Kherty.com/office/2007" 
  xmlns:Internals="clr-namespace:OpenLS.Spreadsheet.UI.Internals" 
  xmlns:Internals1="clr-namespace:OpenLS.UI.Internals;assembly=OpenLS.UI"
  xmlns:Resources="clr-namespace:OpenLS.Spreadsheet.UI.Internals.Resources"
  x:Class="OpenLS.Spreadsheet.UI.FilterColumnResources"
    >
  <ResourceDictionary.MergedDictionaries>
    <ssui:FilterValueResources/>
        <oui:ButtonResources/>
  </ResourceDictionary.MergedDictionaries>
  <HierarchicalDataTemplate DataType="{x:Type ssui:FilterColumnViewModel}">
    <Menu Background="Transparent" Cursor="Arrow">
      <Menu.ItemsPanel>
        <ItemsPanelTemplate>
          <Grid Background="Transparent"/>
        </ItemsPanelTemplate>
      </Menu.ItemsPanel>
      <Menu.CommandBindings>
        <CommandBinding Command ="{x:Static ssui:SpreadsheetCommands.DisplayFilter}" Executed ="OnDisplayFilter"/>
        <CommandBinding Command ="{x:Static ssui:SpreadsheetCommands.ClearFilterColumn}" Executed ="OnClearFilterColumn"/>
      </Menu.CommandBindings>
      <Menu.ItemContainerStyle>
        <Style>
          <Setter Property ="Control.VerticalAlignment" Value="Bottom"></Setter>
        </Style>
      </Menu.ItemContainerStyle>
      <MenuItem oui:RibbonElement.ControlState="Medium" VerticalAlignment="Bottom" >
        <MenuItem.Background>
          <LinearGradientBrush StartPoint="0,0" EndPoint="0,1" >
            <GradientStop Color="#FFEDF1F4" Offset="0" />
            <GradientStop Color="#FFEAECDF" Offset="0.37931034482758547" />
            <GradientStop Color="#FFCFD3DC" Offset="1" />
          </LinearGradientBrush>
        </MenuItem.Background>
        <MenuItem.Template>
          <ControlTemplate TargetType="{x:Type MenuItem}">
            <Border x:Name="ClassicBorder" Background="{TemplateBinding Background}"
                    BorderThickness="1" BorderBrush="#FF879BB4" CornerRadius="2" Margin="0 1 0 0">
              <DockPanel x:Name="ContentPanel" Margin="1">
                <Grid>
                  <Rectangle Width="12" Height="12" />
                  <Path x:Name="Arrow" Margin="2" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="M 0 0L 8 0 L 4 3 Z" DockPanel.Dock="Right"/>
                </Grid>
                <Popup x:Name="SubMenuPopup"
                       VerticalOffset="1" HorizontalOffset="-2"   Placement="Bottom" IsOpen="{Binding Path=IsSubmenuOpen,RelativeSource={RelativeSource TemplatedParent}}" Focusable="false" >
                  <Border Background="White" BorderBrush="Silver" BorderThickness="1">
                    <ItemsPresenter Margin="{TemplateBinding Padding}" KeyboardNavigation.DirectionalNavigation="Cycle" />
                  </Border>
                </Popup>
              </DockPanel>
            </Border>
            <ControlTemplate.Triggers>
              <Trigger Property="IsSubmenuOpen" Value="True">
                <Setter Property="Background" TargetName="ClassicBorder">
                  <Setter.Value>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1" >
                      <GradientStop Color="#FFCDD0D5" Offset="0" />
                      <GradientStop Color="#FFDDDCD8" Offset="0.45614035087719434" />
                      <GradientStop Color="#FFF1F5F8" Offset="1" />
                    </LinearGradientBrush>
                  </Setter.Value>
                </Setter>
              </Trigger>
            </ControlTemplate.Triggers>
          </ControlTemplate>

        </MenuItem.Template>
        <MenuItem.Header>
          <Path Data ="M0,0 L8,0 L 4,3 L 0,0">
            <Path.Fill>
              <LinearGradientBrush StartPoint="0,0" EndPoint="0,1" >
                <GradientStop Color="#FF5C679D" Offset="0" />
                <GradientStop Color="#FF31363A" Offset="1" />
              </LinearGradientBrush>
            </Path.Fill>
          </Path>
        </MenuItem.Header>
        <!--
        <MenuItem Command="{x:Static ssui:SpreadsheetCommands.SortDown}" CommandParameter="{Binding}"/>
        <MenuItem Command="{x:Static ssui:SpreadsheetCommands.SortUp}" CommandParameter="{Binding}"/>
        -->
        <Separator/>
        <MenuItem Command="{x:Static ssui:SpreadsheetCommands.ClearFilterColumn}"/>
        <MenuItem Header="{x:Static Resources:UIStringTable.NumberFilters}">
          <MenuItem Header="{x:Static Resources:UIStringTable.EqualsFilter}" Command="{x:Static ssui:SpreadsheetCommands.DisplayFilter}" CommandParameter="{x:Static ss:FilterOperator.Equal}"/>
          <MenuItem Header="{x:Static Resources:UIStringTable.NotEqualsFilter}" Command="{x:Static ssui:SpreadsheetCommands.DisplayFilter}" CommandParameter="{x:Static ss:FilterOperator.NotEqual}"/>
          <Separator/>
          <MenuItem Header="{x:Static Resources:UIStringTable.GreaterThanFilter}" Command="{x:Static ssui:SpreadsheetCommands.DisplayFilter}" CommandParameter="{x:Static ss:FilterOperator.GreaterThan}"/>
          <MenuItem Header="{x:Static Resources:UIStringTable.GreaterThanOrEqualToFilter}" Command="{x:Static ssui:SpreadsheetCommands.DisplayFilter}" CommandParameter="{x:Static ss:FilterOperator.GreaterThanOrEqual}"/>
          <MenuItem Header="{x:Static Resources:UIStringTable.LessThanFilter}" Command="{x:Static ssui:SpreadsheetCommands.DisplayFilter}" CommandParameter="{x:Static ss:FilterOperator.LessThan}"/>
          <MenuItem Header="{x:Static Resources:UIStringTable.LessThanOrEqualToFilter}" Command="{x:Static ssui:SpreadsheetCommands.DisplayFilter}" CommandParameter="{x:Static ss:FilterOperator.LessThanOrEqual}"/>
          <MenuItem Header="{x:Static Resources:UIStringTable.BetweenFilter}" Command="{x:Static ssui:SpreadsheetCommands.DisplayFilter}"  CommandParameter="{x:Static ss:FilterOperator.Equal}"/>
          <Separator/>
           <!--
          <MenuItem Header="{x:Static Internals:UIStringTable.Top10Filter}"/>
          <MenuItem Header="{x:Static Internals:UIStringTable.AboveAverageFilter}"/>
          <MenuItem Header="{x:Static Internals:UIStringTable.BelowAverageFilter}"/>
          <Separator/> 
          <MenuItem Header="{x:Static Internals:UIStringTable.CustomFilter}"/>
           -->
        </MenuItem>
        <Separator/>
        <MenuItem>
          <MenuItem.Template>
            <ControlTemplate TargetType ="{x:Type MenuItem}">
              <ContentPresenter ContentSource="Header"/>
            </ControlTemplate>
          </MenuItem.Template>
          <MenuItem.Header>
            <StackPanel>
              <!--
              <ListBox ItemsSource="{Binding Values}"
                        Height ="300" Name="treeView"/> -->
              <DockPanel >
                <Button DockPanel.Dock="Right" Style="{StaticResource RegularButton}" MinWidth="70" Margin="3" Click="OnCancel" Content="{x:Static Internals1:UIStringTable.Cancel}"></Button>
                <Button DockPanel.Dock="Right" Style="{StaticResource RegularButton}" MinWidth ="70" Margin="3" Click="OnOK"  Tag="{Binding ElementName=treeView}"  Content="{x:Static Internals1:UIStringTable.OK}"></Button>
              </DockPanel>
            </StackPanel>
          </MenuItem.Header>
        </MenuItem>
      </MenuItem>
    </Menu>
  </HierarchicalDataTemplate>
  <Style x:Key="filterColumnStyle">
    <Setter Property="ssui:WorksheetGrid.Row" Value="{Binding Range.TopLeftCell.Row.Index}"/>
    <Setter Property="ssui:WorksheetGrid.Column" Value="{Binding Column.Index}"/>
    <Setter Property="Control.HorizontalAlignment" Value="Right"/>
    <Setter Property="Control.VerticalAlignment" Value="Stretch"/>
  </Style>

</ResourceDictionary>